﻿using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAO;

namespace BUS
{
    public class HoaDonBUS
    {
        public static bool LapHD(long mHD, long mKH, DateTime n)
        {
            return HoaDonDAO.LapHD(mHD, mKH, n);
        }

        public static double TinhTriGia(long mHD)
        {
            List<HD_ChiTietDTO> LCT = HD_ChiTietBUS.LayDSHDCTTheoMHD(mHD);

            double tG = 0;

            for (int i = 0; i < LCT.Count; i++)
            {
                tG = tG + LCT[i].ThanhTien;
            }

            HoaDonDAO.UpdateTriGia(mHD, tG);

            return tG;
        }

        public static bool KtMaHD(long mHD)
        {
            return HoaDonDAO.KtMaHD(mHD);
        }
    }
}
